//
//  IManager+RCCheckInRequest.m
//  RocketProject
//
//  Created by chen jiedan on 13-9-24.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+RCCheckInRequest.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "FrameworkRelativeDefines.h"
#import "RCCheckInShopList.h"

@implementation IManager (RCCheckInRequest)
-(int64_t)requestCheckInShopList:(NSString *)cityID
                         withLat:(NSString *)lat
                         withLng:(NSString *)lng
                          withPn:(NSInteger)pn
                          withRn:(NSInteger)rn
                    withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == cityID || lat == nil || lng == nil) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    NSString *urlSuffix = [NSString stringWithFormat:kRCCheckInPrefix,cityID,lat,lng,pn,rn];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    KFLog(@"request url %@",url);
    //    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"MerchantDetailJson"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCCheckInShopList class]
                                                     withDataDelegate:delegate];
}

-(int64_t)requestCheckInShopList:(NSString *)cityID
                    withShopName:(NSString *)shopName
                         withLat:(NSString *)lat
                         withLng:(NSString *)lng
                          withPn:(NSInteger)pn
                          withRn:(NSInteger)rn
                    withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == cityID || lat == nil || lng == nil || shopName == nil) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    NSString *urlSuffix = [NSString stringWithFormat:kRCCheckInSearchPrefix,cityID,shopName,lat,lng,pn,rn];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    KFLog(@"request url %@",url);
    //    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"MerchantDetailJson"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCCheckInShopList class]
                                                     withDataDelegate:delegate];
}

@end
